package com.dgj.xls.test;

import static org.nutz.lang.Times.now;

import java.util.Date;

import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Comment;
import org.nutz.dao.entity.annotation.Name;
import org.nutz.dao.entity.annotation.Table;

import com.kerbores.utils.db.data.Entity;
import com.kerbores.xls.anna.Title;

/**
 * 用户
 * 
 * @author wkipy
 *
 */
@Table("gj_user")
@Comment("用户表")
public class User extends Entity {

	@Name
	@Column("u_name")
	@Comment("用户登录名")
	@Title("用户名")
	private String name;

	@Column("u_real_name")
	@Comment("用户真实姓名")
	@Title("用户姓名")
	private String realName;

	@Column("u_pwd")
	@Comment("用户登录密码")
	@Title("用户密码")
	private String password;

	@Column("u_phone")
	@Comment("用户手机号")
	@Title("手机号")
	private String phone;

	@Column("u_email")
	@Comment("用户邮箱")
	@Title("email地址")
	private String email;

	@Column("u_create_time")
	@Comment("创建时间")
	@Title("创建时间")
	private Date createTime = now();

	@Column("u_head_key")
	@Comment("用户头像")
	@Title("用户头像")
	private String headKey;

	@Column("u_status")
	@Comment("用户状态")
	@Title("用户状态")
	private Status status = Status.ACTIVED;

	public String getHeadKey() {
		return headKey;
	}

	public void setHeadKey(String headKey) {
		this.headKey = headKey;
	}

	public boolean isAvailable() {
		return status == Status.ACTIVED;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getRealName() {
		return realName;
	}

	public void setRealName(String realName) {
		this.realName = realName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Status getStatus() {
		return status;
	}

	public void setStatus(Status status) {
		this.status = status;
	}

	/**
	 * 用户状态
	 * 
	 * @author wkipy
	 *
	 */
	public static enum Status {
		ACTIVED("正常"), DISABLED("禁用");
		private String name;

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		private Status(String name) {
			this.name = name;
		}
	}

}
